package Games.PumpGame.Entities
{
	import flash.display.Bitmap;
	import Framework.BaseEntity;
	import Framework.EntityType;
	import Games.PumpGame.Gui.AvatarVisual;
	/**
	 * ...
	 * @author Menno
	 */
	public class Avatar extends BaseEntity
	{
		private var _maxCarry:int = 100;
		private static var _currentCarry:int = 0;
		
		public function Avatar(visual:AvatarVisual) 
		{
			super(visual);
			type = EntityType.CONTROLLABLE;
			(guiComponent as AvatarVisual).maxCarry = maxCarry;
		}
		
		override public function update():void 
		{
			
		}
		
		public function addPump(amount:int):Boolean
		{
			var added:Boolean = true;
			
			currentCarry += amount;
			if (currentCarry > maxCarry)
			{
				currentCarry = maxCarry;
				added = false;
			}
			
			if (currentCarry < 0)
			{
				currentCarry = 0;
				added = false;	
			}
			
			(guiComponent as AvatarVisual).currentCarry = currentCarry;
			(guiComponent as AvatarVisual).update();
			
			return added;
		}
		
		//////////////////////////////////////////////////
		//												//
		// 				PROPERTIES						//
		//												//
		//////////////////////////////////////////////////		
		
		public function get maxCarry():int 
		{
			return _maxCarry;
		}
		
		public function set maxCarry(value:int):void 
		{
			_maxCarry = value;
		}
		
		public static function get currentCarry():int 
		{
			return _currentCarry;
		}
		
		public static function set currentCarry(value:int):void 
		{
			_currentCarry = value;
		}
	}
	
}